<div class="layuimini-container">
    <div class="layuimini-main">
        <fieldset id="searchFieldset_currentTable" class="table-search-fieldset layui-hide">
            <legend>{:lang("common.condition_search")}</legend>
            <form class="layui-form layui-form-pane form-search">
                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">{:lang("user.username")}</label>
                    <div class="layui-input-inline">
                        <input name="u_username_like" class="layui-input" value="{$param.u_username_like|default=''}"
                               placeholder="{:lang('common.input')}{:lang('user.username')}">
                    </div>
                </div>

                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">{:lang("user.nickname")}</label>
                    <div class="layui-input-inline">
                        <input name="u_nickname_like" class="layui-input" value="{$param.u_nickname_like|default=''}"
                               placeholder="{:lang('common.input')}{:lang('user.nickname')}">
                    </div>
                </div>

                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">{:lang("user.mobile")}</label>
                    <div class="layui-input-inline">
                        <input name="u_mobile_like" class="layui-input" value="{$param.u_mobile_like|default=''}"
                               placeholder="{:lang('common.input')}{:lang('user.mobile')}">
                    </div>
                </div>

                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">{:lang("user.role")}</label>
                    <div class="layui-input-inline">
                        <select name="role_id">
                            <option value="0">{:lang("common.choose")}</option>
                            {foreach :roleList() as $key=>$val}
                            <option value="{$key}">{$val}</option>
                            {/foreach}
                        </select>
                    </div>
                </div>

                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">{:lang("common.status")}</label>
                    <div class="layui-input-inline">
                        <select name="u_status_eq" default-value="{$ENABLE}" data-select-type="status"
                                data-select-default="{:lang('common.choose')}">
                        </select>
                    </div>
                </div>

                <div class="layui-form-item layui-inline" style="margin-left:50px">
                    <button type="submit" class="layui-btn layui-btn-normal" data-type="tableSearch"
                            lay-submit lay-filter="search_currentTable">{:lang("common.btn_search")}
                    </button>
                </div>
            </form>
        </fieldset>

        <table id="currentTable"
               data-auth-add="{:auth(request()->controller().'/add')}"
               data-auth-edit="{:auth(request()->controller().'/edit')}"
               data-auth-delete="{:auth(request()->controller().'/delete')}"
               data-auth-password="{:auth(request()->controller().'/password')}"
               data-auth-print="{:auth(request()->controller().'/print')}"
               data-auth-export="{:auth(request()->controller().'/export')}">
        </table>
    </div>
</div>
<script>
    layui.use(['myCommon'], function () {
        let myCommon = layui.myCommon;
        myCommon.table.render({
            where: myCommon.generateCondition()
            , limit: "{$param.limit|default='15'}"
            , cols: [[
                {type: "checkbox"}
                , {field: 'id', title: '{:lang("common.id")}', width: 60, sort: true}
                , {field: 'username', width: 100, title: '{:lang("user.username")}', sort: true}
                , {field: 'nickname', width: 80, title: '{:lang("user.nickname")}', sort: true}
                , {field: 'avatar', width: 56, title: '{:lang("user.avatar")}', templet: myCommon.table.image}
                , {field: 'mobile', width: 102, title: '{:lang("user.mobile")}', sort: true}
                , {field: 'role', minWidth: 80, title: '{:lang("user.role")}'}
                , {field: 'login_num', width: 74, title: '{:lang("user.login_num")}', sort: true}
                , {
                    field: 'status',
                    width: 60,
                    title: '{:lang("common.status")}',
                    sort: true,
                    templet: myCommon.table.type,
                    typeList: 'status'
                }
                , {field: 'update_time', width: 102, title: '{:lang("common.update_time")}', sort: true}
                , {
                    width: 162,
                    title: '{:lang("common.operate")}',
                    templet: myCommon.table.tool,
                    operat: [
                        'edit',
                        [{
                            text: '{:lang("user.btnPassword")}',
                            url: CONFIG.CONTROLLER + '/password',
                            method: 'open',
                            auth: 'password',
                            class: 'layui-btn layui-btn-normal layui-btn-xs',
                        }],
                        'delete'
                    ]
                }
            ]]
        });
        myCommon.listen();
    });
</script>
